package com.itheima.mapper;

import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.security.core.parameters.P;

import java.util.List;
import java.util.Map;

public interface SetMealMapper {
    //新增套餐
    void addSetMeal(Setmeal setmeal);

    //向t_setmeal_checkgroup中间表插入数据
    void addSetMealAndCheckGroup(@Param("setmealId") Integer setmealId, @Param("checkgruopId") Integer checkgruopId);

    //检查组分页查询
    List<Setmeal> findPage(@Param("queryString") String queryString);

    //根据套餐id获取对应的检查组id
    Integer[] findCheckgroupIdsBySetMealId(Integer id);

    //获取对应id的套餐数据
    @Select("select * from t_setmeal where id=#{id}")
    Setmeal findAllSetMeal(@Param("id") Integer id);

    //根据检查组id删除对应t_setmeal_checkgroup表数据
    @Delete("delete from t_setmeal_checkgroup where setmeal_id=#{id}")
    void deleteAssociation(@Param("id") Integer id);

    //修改套餐
    void editSetMeal(Setmeal setmeal);


    //查询所有手机端套餐数据
    @Select("select * from t_setmeal")
    List<Setmeal> findAllSetMealMobilWeb();

    //根据套餐id获取对应的套餐数据
    @Select("select * from t_setmeal where id=#{id}")
    Setmeal finSetMealById(Integer id);

    List<Map> getSetmealReport();

}
